Skip to content

fix: respect hide_if_single across layout and input handlers#1558

Open
shiena wants to merge 4 commits into
raphamorim:mainfrom
shiena:fix/1514
Open

fix: respect hide_if_single across layout and input handlers#1558
shiena wants to merge 4 commits into
raphamorim:mainfrom
shiena:fix/1514

Conversation

@shiena
Copy link
Copy Markdown
Contributor

@shiena shiena commented Apr 25, 2026

Follow-up to #1518 (extending #1516), rebased onto main to resolve conflicts. Adds further fixes uncovered while testing the original
change:

  • Keep tab-bar margin transitions in sync with hide_if_single (110b1c3) — resize_top_or_bottom_line compared
    the new padding against dimension.margin, which apply_taffy_layout zeroes on every run, so the hide_if_single
    transition was missed and update_scaled_margin never fired. Now compares against the grid's authoritative
    scaled_margin, and update_scaled_margin also resyncs Taffy's root size so panels reflow into the freed area. Without
    this, closing the second tab left the tab-bar strip reserved at the top; spawning a new tab pushed the bottom row past the
    window.

@shiena shiena force-pushed the fix/1514 branch 5 times, most recently from 5d68cf4 to 7bda168 Compare April 26, 2026 15:02
@shiena
Copy link
Copy Markdown
Contributor Author

shiena commented Apr 26, 2026

Merging only one of them leaves a different hide-if-single symptom in
place:

@shiena shiena changed the title fix: follow-up to #1518 with hide_if_single + background damage fixes fix: closing the 2nd tab leaves a blank strip and clips the bottom row Apr 26, 2026
@shiena shiena changed the title fix: closing the 2nd tab leaves a blank strip and clips the bottom row fix: respect hide_if_single across layout and input handlers Apr 28, 2026
@shiena shiena force-pushed the fix/1514 branch 11 times, most recently from 85a7485 to 3ab44bb Compare May 4, 2026 02:57
0x0aa and others added 4 commits May 4, 2026 15:57
The shell-exit branch of CloseTerminal called resize_top_or_bottom_line
but never re-applied the taffy layout, so sugarloaf.set_position kept
using the old scaled_margin. With hide_if_single, the surviving tab
left a tab-bar-sized gap at the top, and Renderer::run's per-panel
is_dirty / force_full_damage gate also dropped the queued redraw, so
the closed tab's last frame stayed on screen until the next user input.

Re-apply the layout via update_dimensions and mark the screen dirty.
The PTY performer follows up with a RioEvent::Render, so the existing
event-driven redraw paints the surviving tab once the dirty flag clears
the panel gate — no need to force a synchronous render from inside the
event handler.
resize_top_or_bottom_line compared the new padding against
dimension.margin, but apply_taffy_layout zeroes dimension.margin on
every run. Once that has happened the "previous" margin reads as zero;
when num_tabs drops to 1 and hide_if_single makes padding_y_top zero
too, the comparison short-circuits and update_scaled_margin is never
called. Compare against the grid's scaled_margin (divided by scale)
instead, since that holds the authoritative current margin.

Without this, closing the second tab with hide-if-single enabled left
the tab-bar strip reserved at the top and terminal content drew below
it instead of filling the freed area.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants